TARGET=libjgepetto.jar

SOURCES= \
	$(wildcard src/gepetto/reactor/*.java) \
	$(wildcard src/gepetto/command/*.java) \
	$(wildcard src/gepetto/message/*.java) \
	$(wildcard src/gepetto/util/*.java)

CLASSES=$(SOURCES:%.java=%.class)

CLASSPATH=src/

all: $(TARGET)

$(TARGET): $(CLASSES)
	cd src && jar -cf ../$@ $(CLASSES:src/%=%)

%.class: %.java
	javac -cp $(CLASSPATH) $^

install: all
	install -m 644 $(TARGET) $(DESTDIR)/usr/share/java

deb:
	rm -f ../libjgepetto*{deb,changes} && \
	dpkg-buildpackage -rfakeroot -uc -us -b && \
	rm ../libjgepetto*changes && \
	mv ../libjgepetto*.deb .

clean:
	rm -f $(CLASSES) $(TARGET) *.deb